// 定时器的常用API
#include <stdio.h>
// 过程中给以下文件添加了注释，如果运行出问题，在备份中取一个新的文件覆盖
#include ".\src\device\hisilicon\hispark_pegasus\hi3861_adapter\hals\iot_hardware\wifiiot_lite\hal_iot_gpio.c"
#include <unistd.h>

#include "ohos_init.h"
#include "cmsis_os2.h"
#include <unistd.h>
#include "hi_wifi_api.h"
//#include "wifi_sta.h"
#include "lwip/ip_addr.h"
#include "lwip/netifapi.h"

#include "lwip/sockets.h"


#include "iot_gpio.h"
#include "hi_io.h"

//初始化GPIO与还原

unsigned int IoTGpioInit(unsigned int id);
unsigned int IoTGpioDeinit(unsigned int id);

// 设置GPIO引脚的上下拉是(HI_IO_PULL_NONE,HI_IO_PULL_UP,HI_IO_PULL_DOWN)
// 相当于设置初始时刻GPIO引脚的状态

hi_u32 hi_io_set_pull(hi_io_name id, hi_io_pull val);

// 设置引脚功能HI_IO_FUNC_GPIO_[ID]_[FUNC]

hi_u32 hi_io_set_func(hi_io_name id, hi_u8 val);

// 设置GPIO引脚的方向是输出(IOT_GPIO_DIR_OUT)还是输入(IOT_GPIO_DIR_IN)

unsigned int IoTGpioSetDir(unsigned int id, IotGpioDir dir);

// 设置与获取GPIO引脚的输出/输入电平

unsigned int IoTGpioSetOutputVal(unsigned int id, IotGpioValue val);
unsigned int IoTGpioGetInputVal(unsigned int id, IotGpioValue *val);

// 中断服务的注册与注销

unsigned int IoTGpioRegisterIsrFunc(unsigned int id, IotGpioIntType intType, IotGpioIntPolarity intPolarity,GpioIsrCallbackFunc func, char *arg);
unsigned int IoTGpioUnregisterIsrFunc(unsigned int id);

// 中断服务的设置

unsigned int IoTGpioSetIsrMask(unsigned int id, unsigned char mask);
unsigned int IoTGpioSetIsrMode(unsigned int id, IotGpioIntType intType, IotGpioIntPolarity intPolarity);